export default class Song{
  constructor({id,mid,singer,name,album,duration,image,url}){
  this.id=id
  this.mid = mid
  this.singer = singer
  this.name = name
  this.album = album
  this.duration = duration
  this.image = image
  this.url = url
  }
}
export function creatSong(musicData){
  return new Song({
    id : musicData.id,
    mid: musicData.mid,
    singer: filterSinger(musicData.singer),
    name: musicData.name,
    album: musicData.album,
    duration: musicData.interval,
    iamge: `https://y.gtimg.cn/music/photo_new/T002R150x150M000${musicData.albummid}.jpg?max_age=2592000`,
    url: `https://thirdparty.gtimg.com/${musicData.songid}.m4a?fromtag=38`
  })
}

function filterSinger(singer) {
  let ret =[]
  if (!singer) {
    return ''
  }
  singer.forEach(element => {
    ret.push(element.name)
  });
  return ret.join('/')
}